{{include file="header.tpl"}}
<!--content-->
{{include file="front/borrow/nav.html"}}
<div class="borrow_con w1002 Mar14">
<div class="Fl borrow_lt">
	<h2></h2>
    <div class="borrow_lt_con">
    <form id="borform" name="borform" method="post" action="">
        <input type="hidden" value="{{$user.ID}}" name="user_id">
        <input type="hidden" value="1" name="type">
        <input type="hidden" value="1" name="deal_stat">
    <table width="95%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="21%" height="40" align="right">融资方：</td>
        <td width="79%"><select name="finance" class="borrow_lt_set">
               <option value="1">个人</option>
               <option value="0">公司</option>
            </select></td>
    </tr>
    <tr>
        <td height="40" align="right">借款方式：</td>
        <td><select name="type_borrow" class="borrow_lt_set">
                <option value="1" {{if $smarty.get.type_borrow==1}}selected="selected"{{/if}}>助业贷</option>
                <option value="2" {{if $smarty.get.type_borrow==2}}selected="selected"{{/if}}>助车贷</option>
                <option value="3" {{if $smarty.get.type_borrow==3}}selected="selected"{{/if}}>助房贷</option>
                <option value="4" {{if $smarty.get.type_borrow==4}}selected="selected"{{/if}}>助信贷</option>
            
            </select></td>
    </tr>
    <tr>
        <td height="40" align="right">借款金额：</td>
        <td><input name="price" type="text" class="borrow_lt_set" id="price" />元</td>
    </tr>
    <tr>
        <td height="40">&nbsp;</td>
        <td><span class="Cl_grey ">贷款限额为0.001-120万元</span></td>
    </tr>
    <tr>
        <td height="40" align="right">贷款利率：</td>
        <td><input name="rate" type="text"  class="borrow_lt_set" id="rate"/>%</td>
    </tr>
    <tr>
        <td height="40"></td>
        <td><span class="Cl_grey ">贷款年利率为8-36%</span></td>
    </tr>
    <tr>
        <td height="40" align="right">放款还款方式：</td>
        <td><select name="type_loan" class="borrow_lt_set">
                <option value="1">等额本息</option>
                <option value="2">按月付息，到期还本</option>
            </select></td>
    </tr>
    <tr>
        <td height="40" align="right">借款期限：</td>
        <td><select name="repay_time" class="borrow_lt_set">
            <option value="1">一个月</option>
            <option value="3">三个月</option>
            <option value="6">六个月</option>
            <option value="12">12个月</option>
            <option value="24">24个月</option>
            <option value="36">36个月</option>
            </select></td>
    </tr>
    <tr>
        <td height="40" align="right">借款用途：</td>
        <td><textarea name="content" cols="" rows="" class="borrow_lt_area" id="content"></textarea></td>
    </tr>
    <tr>
        <td height="40" align="right">借款协议：</td>
        <td><input name="agree" type="checkbox" value="1" checked="checked"/>农易贷《<span class="Cl_blue">借款协议</span>》与《<span class="Cl_blue">借款承诺书</span>》</td>
    </tr>
    <tr>
        <td height="60">&nbsp;</td>
        <td><input name="submit" type="submit" id="subloan" class="borrow_submit" value="立即申请"/></td>
    </tr>
</table>
        </form>
    </div>
<div class="borrow_lt_bg"></div>    
</div>
<div class="Fr borrow_ri">
<h2></h2>
<div class="borrow_lt_con">
    
<table width="95%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="21%" height="60" align="right">贷款金额：</td>
        <td width="79%"><input name="jsprime" type="text"  class="borrow_lt_set"/>元</td>
    </tr>
    <tr>
        <td height="60" align="right">年化利率：</td>
        <td><input name="jsinterest" type="text"  class="borrow_lt_set"/>%</td>
    </tr>
    <tr>
        <td height="60" align="right">还款方式：</td>
        <td>等额本息</td>
    </tr>
    <tr>
        <td height="60" align="right">借款方式：</td>
        <td>
            <select name="jstime" class="borrow_lt_set">
            <option value="1">一个月</option>
            <option value="3">三个月</option>
            <option value="6">六个月</option>
            <option value="12">12个月</option>
            <option value="24">24个月</option>
            <option value="36">36个月</option>
            </select></td>
    </tr>
    <tr>
        <td height="60" align="right">月还本息：</td>
        <td><input name="jsresult" type="text" value="" class="borrow_lt_set" readonly="readonly"/>
            万元</td>
    </tr>
    <tr>
        <td height="60" align="right">共还本息：</td>
        <td><input name="jsresultini" type="text" value="" class="borrow_lt_set" readonly="readonly"/>元
		</td>
    </tr>
    <tr>
        <td height="100" colspan="2"><input name="" type="submit" class="borrow_submit" value="计算器" onclick="jsbenxi();"/></td>
        </tr>
</table>
	
</div>
<div class="borrow_lt_bg"></div> 
</div>
<br class="Spacer1" />
</div>
<script type="text/javascript">
      $('#subloan').click(function(){
            if($('#price').val()!="" && $('#rate').val()!=""&& $('#content').val()!=""){
                var param = $('#borform').serialize();
//                $.jBox.tip('正在申请...','loading');
                $.post("index.php?ctl=borrow&act=Save",param,function(res){
                    var submit =function(v,g,f){
                    if(v == "ok")
                         window.open(res.tourl,"_top");                         
                    }
                    if(res.code == 'success'){
                        $.jBox.confirm("申请成功。请进行第二步填写认证信息！","提示",submit);
                       
                    }else{
                        $.jBox.confirm(res.msg,"提示",submit);
                    }
                },"json");          
            }else if($('#price').val()==""){
                $.jBox.alert('请填写借款金额','提示');
            }
            else if($('#rate').val()==""){
                $.jBox.alert('贷款利率','提示');
            }
            else if($('#content').val()==""){
                $.jBox.alert('请填写借款用途','提示');
            }
            return false;
            
        });
    function jsbenxi(){
        var jsprime = $("input[name='jsprime']").val();
        var jsinterest = $("input[name='jsinterest']").val();
        var jstime = $("select[name='jstime']").val();
        if(jsprime == ""){
            alert("请输入金额！");
            return false;
        }
        if(jsinterest == ""){
            alert("请输入贷款利率！");
            return false;
        }
        var jsresult;
        var jsresultini;
        var m=parseFloat(jsinterest)/1200;
        //
        var jm=1;
        for($i=0;$i<jstime;$i++){
            jm*=(1+parseFloat(m));
        }
        jsresult=parseFloat(jsprime)*parseFloat(m)+parseFloat(jsprime)*parseFloat(m)/(parseFloat(jm)-1);
        jsresultini=jsresult*jstime;
        jsresult=parseFloat(jsresult).toFixed(2);
        jsresultini=parseFloat(jsresultini).toFixed(2);
        $("input[name='jsresult']").attr("value",jsresult);
        $("input[name='jsresultini']").attr("value",jsresultini);
    }
</script>

{{include file="footer.tpl"}}